<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function compileTemplate ($source)
{


	require_once (SMARTY_DIR.'Smarty.class.php');
	$smarty = new Smarty();

	$tpl = $smarty->createTemplate('string:'.$source);


	$mesg = '';
	$line = 0;

	try {
		error_reporting(0);
		$tpl->compiler->compileTemplate($tpl);
	} catch (Exception $e) {
		$mesg = $e->getMessage();
		$prev = $e->getTrace();
		print_r ($e);
		//$mesg = $prev[0]['args'][0];
		//$line = $prev[0]['args'][1];
	}

	error_reporting($prev_state);

	return array ($line, $mesg);

}